﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Binding基础
{
    /// <summary>
    /// Slider_Textbox.xaml 的交互逻辑
    /// </summary>
    public partial class Slider_Textbox : Window
    {
        public Slider_Textbox()
        {
            InitializeComponent();
            //List<string> strings = new List<string>() { "Tom", "Jack", "blog" };
            //textbox1.SetBinding(TextBox.TextProperty,new Binding("/") { Source = strings });
            //textbox2.SetBinding(TextBox.TextProperty,new Binding("/Length") { Source = strings ,Mode= BindingMode.OneWay});
            //textbox3.SetBinding(TextBox.TextProperty,new Binding("/[2]") { Source = strings , Mode = BindingMode.OneWay });

            List<contry> contries = new List<contry>() { new contry() { Name = "China", provinces = new List<province>() { new province() { Name = "sichun", city = new List<city>() { new city() { Name = "dsb" } } } } } };


            //this.textbox1.SetBinding(TextBox.TextProperty, new Binding("/Name") { Source = contries });
            //this.textbox2.SetBinding(TextBox.TextProperty, new Binding("/provinces/Name") { Source = contries });
            //this.textbox3.SetBinding(TextBox.TextProperty, new Binding("/provinces/city/Name") { Source = contries });
        }

    }

    public class Stu
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public int Age { get; set; }

    }

    class contry
    {
        public string Name { set; get; }
        public List<province> provinces { set; get; }
    }


    class province
    {
        public string Name { set; get; }
        public List<city> city { set; get; }
    }

    class city
    {
        public string Name { set; get; }
    }
}
